package com.kert.word.controller;

import com.kert.word.service.DocxService;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.xml.sax.SAXException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.io.IOException;

@RestController
public class DocxController {
    @Autowired
    private DocxService docxService;

    @PostMapping("/read")
    public void read(MultipartFile file) throws IOException, OpenXML4JException, ParserConfigurationException, TransformerException, SAXException {
        docxService.readDoc(file.getInputStream());
    }
}
